class Town < ActiveRecord::Base
  belongs_to    :county
  has_many      :populations
  
  def Town.with_ruler(character)
    return nil unless character
    towns = Town.find(:all)
    for town in towns
      ruler = town.ruler
      return town unless ruler.nil? or ruler.id != character.id
    end
    return nil
  end
  
  def ruler
    Title.earl_of self
  end
end
